#include<iostream>
#include<algorithm>
using namespace std;
const int N = 20;
int cat[N], car[N];
int n, w;
int ans = 20;
int cmp(int a, int b)
{
	return a > b;
}
void dfs(int u, int sum)
{
	if (sum >= ans) return;
	if (u == n) {
		ans = sum;
		return;
	}
	for (int i = 0; i < sum; i++) {
		if (car[i] + cat[u] <= w) {
			car[i] += cat[u];
			dfs(u + 1, sum);
			car[i] -= cat[u];
		}
	}
	car[sum] = cat[u];
	dfs(u + 1, sum + 1);
	car[sum] -= cat[u];
}
int main()
{
	cin >> n >> w;
	for (int i = 0; i < n; i++) {
		cin >> cat[i];
	}
	sort(cat, cat + n, cmp);
	// 	for (int i = 0; i < n; i++) {
	// 		cout << cat[i] << " ";
	// 	}
	dfs(0, 0);
	cout << ans << endl;
	return 0;
}